﻿using System;
using System.Diagnostics;
using System.IO;

namespace Eugenhome.Atrium.Site.Web.Bookmark
{
    /// <summary>
    /// 
    /// </summary>
    public partial class open : System.Web.UI.Page
    {
        /// <summary></summary>
        private Login _login = new Login();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            _login.Check();

            string url = Request.QueryString["url"];

            if (url != null && !url.Equals(string.Empty))
            {
                string physPath = Server.MapPath(url);

                if (File.Exists(physPath))
                {
                    string content = _login.DecryptContent(physPath);

                    Response.Clear();
                    Response.Write(content);
                    Response.Flush();
                    Response.End();
                }
            }
            else
            {
                Response.Write("Kein URL zum Öffnen übergeben!");
            }
        }
    }
}